{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'\\n<AR4>dis version\\nHuawei Versatile Routing Platform Software\\nVRP (R) software, Version 5.130 (AR2200 V200R003C00)\\nCopyright (C) 2011-2012 HUAWEI TECH CO., LTD\\nHuawei AR2220 Router uptime is 0 week, 0 day, 0 hour, 21 minutes\\nBKP 0 version information:\\n1. PCB      Version  : AR01BAK2A VER.NC\\n2. If Supporting PoE : No\\n3. Board    Type     : AR2220\\n4. MPU Slot Quantity : 1\\n5. LPU Slot Quantity : 6\\n\\nMPU 0(Master) : uptime is 0 week, 0 day, 0 hour, 21 minutes\\nMPU version information :\\n1. PCB      Version  : AR01SRU2A VER.A\\n2. MAB      Version  : 0\\n3. Board    Type     : AR2220\\n4. BootROM  Version  : 0\\n\\n<AR4>\\n'"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "str = '''\n",
    "<AR4>dis version\n",
    "Huawei Versatile Routing Platform Software\n",
    "VRP (R) software, Version 5.130 (AR2200 V200R003C00)\n",
    "Copyright (C) 2011-2012 HUAWEI TECH CO., LTD\n",
    "Huawei AR2220 Router uptime is 0 week, 0 day, 0 hour, 21 minutes\n",
    "BKP 0 version information:\n",
    "1. PCB      Version  : AR01BAK2A VER.NC\n",
    "2. If Supporting PoE : No\n",
    "3. Board    Type     : AR2220\n",
    "4. MPU Slot Quantity : 1\n",
    "5. LPU Slot Quantity : 6\n",
    "\n",
    "MPU 0(Master) : uptime is 0 week, 0 day, 0 hour, 21 minutes\n",
    "MPU version information :\n",
    "1. PCB      Version  : AR01SRU2A VER.A\n",
    "2. MAB      Version  : 0\n",
    "3. Board    Type     : AR2220\n",
    "4. BootROM  Version  : 0\n",
    "\n",
    "<AR4>\n",
    "'''\n",
    "str"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['\\n',\n",
       " '<AR4>dis version\\n',\n",
       " 'Huawei Versatile Routing Platform Software\\n',\n",
       " 'VRP (R) software, Version 5.130 (AR2200 V200R003C00)\\n',\n",
       " 'Copyright (C) 2011-2012 HUAWEI TECH CO., LTD\\n',\n",
       " 'Huawei AR2220 Router uptime is 0 week, 0 day, 0 hour, 21 minutes\\n',\n",
       " 'BKP 0 version information:\\n',\n",
       " '1. PCB      Version  : AR01BAK2A VER.NC\\n',\n",
       " '2. If Supporting PoE : No\\n',\n",
       " '3. Board    Type     : AR2220\\n',\n",
       " '4. MPU Slot Quantity : 1\\n',\n",
       " '5. LPU Slot Quantity : 6\\n',\n",
       " '\\n',\n",
       " 'MPU 0(Master) : uptime is 0 week, 0 day, 0 hour, 21 minutes\\n',\n",
       " 'MPU version information :\\n',\n",
       " '1. PCB      Version  : AR01SRU2A VER.A\\n',\n",
       " '2. MAB      Version  : 0\\n',\n",
       " '3. Board    Type     : AR2220\\n',\n",
       " '4. BootROM  Version  : 0\\n',\n",
       " '\\n',\n",
       " '<AR4>\\n']"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "str.splitlines(True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'VRP (R) software, Version 5.130 (AR2200 V200R003C00)\\n'"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "str.splitlines(True)[3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['VRP (R) software', ' Version 5.130 (AR2200 V200R003C00)\\n']"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "str.splitlines(True)[3].split(',')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "' Version 5.130 (AR2200 V200R003C00)\\n'"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "str.splitlines(True)[3].split(',')[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "' Version 5.130 (AR2200 V200R003C00'"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "str.splitlines(True)[3].split(',')[1][0:-2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "strlsw = '''\n",
    "Info: The max number of VTY users is 5, and the number\n",
    "      of current VTY users on line is 1.\n",
    "      The current login time is 2022-01-24 16:48:10.\n",
    "<LSW5>dis version\n",
    "Huawei Versatile Routing Platform Software\n",
    "VRP (R) software, Version 5.110 (S3700 V200R001C00)\n",
    "Copyright (c) 2000-2011 HUAWEI TECH CO., LTD\n",
    "\n",
    "Quidway S3700-26C-HI Routing Switch uptime is 0 week, 0 day, 0 hour, 22 minutes\n",
    "<LSW5>\n",
    "'''"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "4e0b39fdc4f2df2992ef135d097972ec225e019845a073717c5b1bc8df292c8a"
  },
  "kernelspec": {
   "display_name": "Python 3.10.2 64-bit",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.2"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
